<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@include file="/common/definition.jsp"%>

<html:html>
<tiles:insert beanName="shop-definition" flush="true">
	<tiles:put name="title"> Tìm Kiếm Sản Phẩm </tiles:put>
	<tiles:put name="body" type="string">	
		<div class="col-md-10" style="padding-left: 15px;">
		<div class="mainHome" style="padding: 20px">
			<table id="Result"
				class="table table-striped table-hover table-condensed m-melanin-datatable">
				<thead>
					<tr>
						<th class="col-md-1"><font size="2">Hình Ảnh</font>
						</th>
						<th class="col-md-4 text-center"><font size="2">Sản Phẩm</font>
						</th>
						<th class="col-md-2"><font size="2">Cửa hàng bán</font>
						</th>
						<th class="col-md-3 text-center"><font size="2">Lượt theo dõi hiện tại</font>
						</th>
						<th class="col-md-2 "><font size="2">Đăng bán</font>
						</th>

					</tr>
				</thead>
				<tbody>
					<s:iterator value="productModel.listProduct">
						<tr>
							<td class="col-md-2 text-center"><s:a action="clickDetailProduct"><img
								src="<s:property value='mainImgLink'/>" style="height: 70px"
								width=100%><s:param name="productID" value="%{productID}"></s:param>
								</s:a></td>
							<td ><s:a action="clickDetailProduct"><s:property value="catName" />
								<s:property value="brandName" />
								<s:property value="productName" />
								<s:param name="productID" value="%{productID}"></s:param></s:a>
							</td>
							<td> 
								<s:if test="agentSellingCount == 0">	
									<p class="text-danger">Không có cửa hàng bán</p>
								</s:if>
								<s:else>
									<p class="text-danger"><s:property value="agentSellingCount"/> cửa hàng
									</p>
								</s:else>
							</td>
							<td> 
								<s:if test="favorite == 0">
									<p class="text-success text-center">Hiện không có theo dõi</p>
								</s:if>
								<s:else>
									<p class="text-success text-center"><s:property value="favorite"/>
									lượt </p>
								</s:else>
							</td>
							<td class="col-md-1"><div class="btn-group">
								<s:if test="listID == null">
									<s:a cssClass="btn btn-primary" action="saleLink">Đăng Bán<s:param name="productID">
											<s:property value="productID" />
										</s:param>
									</s:a>
								</s:if>
								<s:else>
									<s:a cssClass="btn btn-danger disabled" action="saleLink">Đã Đăng<s:param name="productID">
											<s:property value="productID" />
										</s:param>
									</s:a>
								</s:else>
								</div></td>
						</tr>
					</s:iterator>
				</tbody>
			</table>
		</div>
		</div>
		<script type="text/javascript" src="js/jquery.dataTables.js"></script>
		<script src="js/datatables.js"></script>
		<script type="text/javascript">
			$(document)
					.ready(
							function() {
								$('#Result')
										.dataTable(
												{
													"sPaginationType" : "bs_full",
													"oLanguage" : {
														"sSearch" : "",
														"sZeroRecords" : "Không có dữ liệu",
														"sEmptyTable" : "Không có dữ liệu",
														"sInfo" : "Hiển thị từ _START_ đến _END_. Tổng cộng: _TOTAL_ dòng.",
														"sInfoFiltered" : "",
														"sLengthMenu" : "Hiển thị _MENU_ Dòng",
														"sInfoEmpty" : 'Không tìm thấy dữ liệu.'
													}
												});
								$('#Result')
										.each(
												function() {
													var datatable = $(this);
													// SEARCH - Add the placeholder for Search and Turn this into in-line form control
													var search_input = datatable
															.closest(
																	'.dataTables_wrapper')
															.find(
																	'div[id$=_filter] input');
													search_input.attr(
															'placeholder',
															'Tìm Nhanh');
													search_input
															.addClass('form-control input-sm');
													// LENGTH - Inline-Form control
													var length_sel = datatable
															.closest(
																	'.dataTables_wrapper')
															.find(
																	'div[id$=_length] select');
													length_sel
															.addClass('form-control input-sm');
												});
							});
		</script>

	</tiles:put>
</tiles:insert>
</html:html>

